package com.vdong.data.service.impl;

import com.vdong.data.model.ShipperOrderUser;
import com.vdong.data.repository.ShipperOrderUserRepository;
import com.vdong.data.service.ShipperOrderUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author: liangwei
 */
@Service
public class ShipperOrderUserServiceImpl implements ShipperOrderUserService {

    @Autowired
    private ShipperOrderUserRepository shipperOrderUserRepository;

    @Override
    public void save(ShipperOrderUser shipperOrderUser) {
        shipperOrderUserRepository.save(shipperOrderUser);

    }

    @Override
    public void del(ShipperOrderUser shipperOrderUser) {
        shipperOrderUserRepository.delete(shipperOrderUser);
    }

    @Override
    public ShipperOrderUser get(int id) {
        return shipperOrderUserRepository.findOne(id);

    }

    @Override
    public ShipperOrderUser findbyShipperIdAndUserIdAndKey(int shipperId, String userId, String usersKey) {

        return shipperOrderUserRepository.findByShipperIdAndUserIdAndUsersKey(shipperId, userId, usersKey);

    }

    @Override
    public List<ShipperOrderUser> findByUserIdAndKey(String userId, String usersKey) {
        return shipperOrderUserRepository.findByUserIdAndUsersKey(userId, usersKey);
    }
}
